import axios from 'axios'

const instance = axios.create({
    baseURL: 'http://localhost:8091/api',
    timeout: 100000,
    headers: {'X-Custom-Header': 'foobar'}
});
export const $setToken = (token:string) =>{
    instance.defaults.headers.common['token']=token
}
export const $get = async (url:string,params?:any)=>{
    let {data} = await instance.get(url, params)
    return data
}
export const $postParms=async (url,body,params)=>{
    let {data} =await instance.post(url,body,{params:params})
    return data
}
export const $post = async (url,params)=>{
    let {data} = await instance.post(url, params)
    return data
}

export const $delete = async (url,params)=>{
    let {data} = await instance.delete(url, params)
    return data
}

export const $put = async (url,params)=>{
    let {data} = await instance.put(url,params)
    return data
}
